﻿using System;


/// <summary>
/// 接口|资产加载策略
/// </summary>
public interface IAssetLoader
    {
        /// <summary>
        /// 同步加载资产
        /// </summary>
        /// <typeparam name="T">资产类型</typeparam>
        /// <param name="key">资产标识（路径/地址等）</param>
        /// <returns>加载的资产</returns>
        T Load<T>(string key) where T : UnityEngine.Object;

        /// <summary>
        /// 异步加载资产
        /// </summary>
        /// <typeparam name="T">资产类型</typeparam>
        /// <param name="key">资产标识</param>
        /// <param name="onCompleted">加载完成回调</param>
        void LoadAsync<T>(string key, Action<T> onCompleted) where T : UnityEngine.Object;

        /// <summary>
        /// 卸载资产
        /// </summary>
        /// <param name="asset">要卸载的资产</param>
        void Unload(UnityEngine.Object asset);

        /// <summary>
        /// 释放所有加载的资源（针对当前策略）
        /// </summary>
        void ReleaseAll();
    }
